home *** CD-ROM | disk | FTP | other *** search
- TYPE RegType
- ax AS INTEGER
- bx AS INTEGER
- cx AS INTEGER
- dx AS INTEGER
- bp AS INTEGER
- si AS INTEGER
- di AS INTEGER
- flags AS INTEGER
- ds AS INTEGER
- es AS INTEGER
- END TYPE
-
- DECLARE FUNCTION GetDrive$ ()
- DECLARE SUB InterruptX (intnum AS INTEGER, inreg AS RegType, outreg AS RegType)
-
- DIM regs AS RegType
-
- IF COMMAND$ <> "" THEN
- Drive$ = LEFT$(COMMAND$, 1)
- ELSE
- Drive$ = GetDrive$
- END IF
-
- 'get the free disk space
-
- regs.ax = &H3600 'function 36H: get disk allocation info.
- regs.dx = ASC(Drive$) - 64 'Drive #: 0=default, 1=A:, 2=B:, etc
- CALL Interrupt(&H21, regs, regs) 'call int 21H
- BytesAvail& = regs.ax * regs.cx 'AX=Sectors/Custer, CX=Bytes/Sector
- BytesAvail& = regs.bx * BytesAvail& 'BX=Number of available clusters
- 'DX returns the Cluters/Drive, but is
- 'is not used in this routine.
-
- BytesTotal& = regs.cx * regs.ax
- BytesTotal& = BytesTotal& * regs.dx
-
- 'get disk ID byte
-
- regs.ax = &H1C00
- regs.dx = ASC(Drive$) - 64
- CALL InterruptX(&H21, regs, regs)
-
- DEF SEG = regs.ds
- IDB = PEEK(regs.bx)
- DEF SEG
-
- SELECT CASE IDB
- CASE &HF0
- PRINT "3.5 inch floppy, 1.44 meg, double sided, 18 sectors/track."
- CASE &HF8
- PRINT "Fixed disk."
- CASE &HF9
- IF BytesTotal& > 800000 THEN
- PRINT "5.25 inch floppy, 1.2 meg, double sided, 15 sectors/track."
- ELSE
- PRINT "3.5 inch floppy, 720K, double sided, 9 sectors/track."
- END IF
- CASE &HFC
- PRINT "5.25 inch floppy, 180K, single sided, 9 sectors/track."
- CASE &HFD
- PRINT "5.25 inch floppy, 360K, double sided, 9 sectors/track."
- CASE &HFE
- PRINT "5.25 inch floppy, 160K, single sided, 8 sectors/track."
- CASE &HFF
- PRINT "5.25 inch floppy, 320K, double sided, 8 sectors/track."
- CASE ELSE
- END SELECT
-
- PRINT USING "###,###,###"; BytesTotal&; : PRINT " bytes total disk space,"
- PRINT USING "###,###,###"; BytesAvail&; : PRINT " bytes available."
-
- FUNCTION GetDrive$
-
- DIM regs AS RegType
- regs.ax = &H1900
- CALL Interrupt(&H21, regs, regs)
- GetDrive$ = CHR$(65 + regs.ax MOD 256)
-
- END FUNCTION
-
-